<?php

use yii\helpers\Html;
//use yii\grid\GridView;
use kartik\grid\GridView;


$this->title = '人员管理';
$this->params['breadcrumbs'][] = $this->title;

?>
<div class="customer-index">

    <h2 class="page-header"><?= Html::encode($this->title) ?>
        <p class="pull-right"></p>
    </h2>
    

    <p>
        <?php  echo $this->render('_search', ['model' => $searchModel]); ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'layout'  =>  "{items}\n{pager}",
        //'pjax'=>true,
        //'striped'=>true,
        //'hover'=>true,
        'columns' => [
            //['class' => 'yii\grid\SerialColumn'],
            // ['class'=>'kartik\grid\SerialColumn'],
            //'id',
            //'room_use_id',
            [
                'label' => '房间名称',
                'format'=>'raw',
                'attribute' => 'room_use_id',
                'value'=>function ($model) {
                    $room =  $model->roomUse->room->name.' '.$model->roomUse->room->code. ' '.$model->roomUse->num.'人间';
                    return $room;
                },
            ],
            [
                'label' => '姓名',
                'format'=>'raw',
                'value'=>function ($model) {
                    return $model->first_name.$model->last_name;
                },
            ],
            //'en_first_name',
            //'en_last_name',
            //'pinyin',
            //'gender',
            [
                'attribute' => 'gender',
                'filter' =>  Yii::$app->params['gender'],
                'value' => function ($model) {
                    return isset(Yii::$app->params['gender'][$model->gender])?Yii::$app->params['gender'][$model->gender]:'';
                },
                'format' => 'raw',
            ],
            'birthday',
            //'country',
            //'passport',
            //'passport_add',
            //'passport_date',
            //'passport_type',
            'phone',
            'remark',
            'group',
            'supply',
            //'status',
             [
                'attribute' => 'status',
                'filter' =>  Yii::$app->params['status'],
                'value' => function ($model) {
                    return Yii::$app->params['status'][$model->status];
                },
                'format' => 'raw',
            ],
            //'user_id',
            //'created_at',
            //'updated_at',

            ['class' => 'yii\grid\ActionColumn',
              'template' =>"{view} {update}"  
            ],
        ],
    ]); ?>
</div>
